/**
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.watchmen.mini.common.config;


import com.watchmen.mini.common.utils.ErrorMsg;

/**
 * Service层公用的Exception, 从由Spring管理事务的函数中抛出时会触发事务回滚.
 * @author ThinkGem
 */
public class ServiceException extends RuntimeException {

	private static final long serialVersionUID = 1L;
    private String code;

	public ServiceException(ErrorMsg errorMsg){
		new ServiceException(errorMsg.getCode(),errorMsg.getMessage());
	}  
	
	public ServiceException() {
		super();
	}

	public ServiceException(String message) {
		super(message);
	}

    public ServiceException(String code, String message) {
        super(message);
	    this.code = code;
    }

	public ServiceException(Throwable cause) {
		super(cause);
	}

	public ServiceException(String message, Throwable cause) {
		super(message, cause);
	}

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

}
